package com.twu.biblioteca;

import com.twu.biblioteca.command.Command;
import com.twu.biblioteca.command.CommandFactory;
import com.twu.biblioteca.movie.MovieManager;
import com.twu.biblioteca.util.Validator;


public class Library {

    private BookManager bookManager;
    private MovieManager movieManager;
    private Validator validator;

    private boolean quit = false;

    public static final String showOptions = "Input the following number to select option:\n" +
            "1 for show all books,\n " +
            "2 for reserve book,\n " +
            "3 for check membership,\n" +
            "4 for show movies\n" +
            "6 for quit\n";

    public Library(BookManager bookManager, MovieManager movieManager) {
        this.bookManager = bookManager;
        this.movieManager = movieManager;
    }

    public void excuteOption(String userOption) throws Exception {
        validator.validateOption(userOption);
        Command command = CommandFactory.createCommand(userOption, this);
        command.execute();
    }

    public void setQuit() {
         this.quit = true;
    }

    public boolean isQuit() {
        return quit;
    }

    public void setValidator(Validator validator) {
        this.validator = validator;
    }

    public MovieManager getMovieManager() {
        return movieManager;
    }

    public BookManager getBookManager() {
        return bookManager;
    }

}
